<template>
  <div>
    <div class="title">
      <!-- <slot name="title">
       
      </slot> -->
       <h4>芙蓉楼送辛渐</h4>
     
      <span class="btn" @click="fn"> {{ isShow ? "收起" : "展开" }} </span>
    </div>
    <div class="container" v-show="isShow">
      <!-- 设置插槽的默认值,在slot标签内书写即可 -->
      <slot :row="obj"></slot>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isShow: true,
      obj:{
        firstname:"胡文帅是猪",
        lastname:"胡文帅吃电脑屏幕"
      }
    };
  },

  mounted() {},

  methods: {
    fn() {
      this.isShow = !this.isShow;
    },
  },
};
</script>

<style lang="less" scoped>
// scoped出现的意义是为了让当前style中的样式只对当前的template中的标签生效,不会影响其他组件的标签
.title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccc;
  padding: 0 1em;
}
.title h4 {
  line-height: 2;
  margin: 0;
}
.container {
  border: 1px solid #ccc;
  padding: 0 1em;
}
.btn {
  /* 鼠标改成手的形状 */
  cursor: pointer;
}
</style>